/**
 * 
 */
package ultility;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;


/**
 * @author NhatHung
 * 
 */
public class ReadDataConnect {

	final static String CONNECTION_FILE = "C:\\database\\connection.txt";
	static FileInputStream iFile;
	static Scanner read;

	public static String getConnectionURL() {
		String url = "";
		try {
			iFile = new FileInputStream(CONNECTION_FILE);
			read = new Scanner(iFile, "UTF-8");

			// read connection string
			url = url.concat(read.nextLine() + ";") + "user=";
			url = url.concat(read.nextLine() + ";") + "password=";
			url = url.concat(read.nextLine() + ";");
			
			read.close();
			iFile.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return url;
	}
}
